package com.zyg.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zyg.pojo.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT sr.role_name FROM user_role ur JOIN sys_role sr ON ur.r_id = sr.role_id WHERE ur.u_id = #{loginId}")
    @Results({
            @Result(property = "roleName", column = "role_name")
    })
    List<String> getRoleList(@Param("loginId") Long loginId);

}
